package com.daylive.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.daylive.dao.UserDao;
import com.daylive.model.SysMsg;
import com.daylive.model.TypeUser;
import com.daylive.model.User;
import com.daylive.page.Page;


@Service
public class UserService {
	private final int PAGE_SIZE = 10;
	@Autowired
	private UserDao userDao;
	
	public Page<User> getUserList(String name,int pageNumber) {
		Page<User> page = new Page<User>(pageNumber, PAGE_SIZE);
		List<User> list = userDao.getUserList(name, page);
		page.setResultList(list);
		return page;
	}
	public List<User> getUserList() {
		List<User> list = userDao.getUserList();
		return list;
	}
	public List<TypeUser> getTypeUserList() {
		List<TypeUser> list = userDao.getTypeUserList();
		return list;
	}
	public User getUserById(int id) {
		return userDao.getUserById(id);
	}
	public User getUserByAccount(String account) {
		return userDao.getUserByAccount(account);
	}
	public User getUserByPhone(String phone) {
		return userDao.getUserByPhone(phone);
	}
	public int addUser(User user) {
		return userDao.addUser(user);
	}
	public int updateUser(User user) {
		return userDao.updateUser(user);
	}
	public int delUser(int id) {
		return userDao.delUser(id);
	}
	public int delAll(String[] ids) {
		return userDao.delAll(ids);
	}
	public int addSysMsg(SysMsg sysMsg) {
		return userDao.addSysMsg(sysMsg);
	}
	public int updateMailFormat(User user) {
		return userDao.updateMailFormat(user);
	}
}
